package com.gw.vip.common.vo;

import lombok.Data;

/**
 * @author GW
 * @description 返回实体类
 * @since 2022-03-29
 */
@Data
public class Result {

    private static final String CODE_SUCCESS="00000";
    private static final String MSG_SUCCESS="success";

    /** 返回码 **/
    private String resultCode;

    /** 返回信息 **/
    private String resultMsg;

    /** 数据信息 **/
    private Object data;

    public Result(){

    }

    /**
     * 交易成功
     * @return 结果
     */
    public static Result success(){
        Result result = new Result();
        result.resultCode = CODE_SUCCESS;
        result.resultMsg = MSG_SUCCESS;
        return result;
    }

    /**
     * 交易成功
     * @param data 数据信息
     * @return 结果
     */
    public static Result success(Object data){
        Result result = new Result();
        result.data = data;
        result.resultCode = CODE_SUCCESS;
        result.resultMsg = MSG_SUCCESS;
        return result;
    }

    /**
     * 交易失败
     * @param resultCode 失败码
     * @param resultMsg 失败信息
     * @return 结果
     */
    public static Result failure(String resultCode, String resultMsg){
        Result result = new Result();
        result.resultCode=resultCode;
        result.resultMsg=resultMsg;
        return result;
    }
}
